package com.homestay.controller;

import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.homestay.service.GetMessageCode;


/**
 * 
 * @Title:SendSms
 * @Description：接收页面传过来的电话号码
 */
@Controller
public class SendSms  {
	
	@RequestMapping("/sendSMS.action")
	public void SendMsg(HttpServletRequest req, HttpServletResponse resp){
		String phone=req.getParameter("phone");
		//根据获取到的手机号发送验证码
		String code=GetMessageCode.getCode(phone); 
		System.out.println(code);
		try {
			resp.getWriter().print(code);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	
	}
	
//	 @Override
//	public void doPost(HttpServletRequest req, HttpServletResponse resp)
//			throws ServletException, IOException {
//		String phone=req.getParameter("phone");
//		//根据获取到的手机号发送验证码
//		String code=GetMessageCode.getCode(phone); 
//		System.out.println(code);
//		resp.getWriter().print(code);
//	}
}
